<?xml version="1.0" encoding="UTF-8" ?>
<!--
Copyright 2015 Christian Hildebrandt

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core" xmlns:composite="http://java.sun.com/jsf/composite" xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:head>
</h:head>
<h:body>
	<composite:interface>
		<composite:attribute name="name" required="true" />
		<composite:attribute name="label" required="true" />
		<composite:attribute name="value" required="true" />
		<composite:attribute name="placeholder" required="false" />
		<composite:attribute name="required" required="false" />
		<composite:attribute name="requiredMessage" required="false" default="An input is required" />
		<composite:attribute name="validatorMessage" required="false" default="Invalid input" />

		<!-- 		<composite:editableValueHolder name="input" targets="input" /> -->
	</composite:interface>

	<composite:implementation>
		<h:panelGroup layout="block"
			styleClass="#{not empty facesContext.getMessageList(''.concat(cc.clientId).concat(':').concat(cc.attrs.name)) ? 'form-group has-error':'form-group'}">
			<h:outputLabel for="#{cc.attrs.name}" value="#{(not empty cc.attrs.required and cc.attrs.required) ? cc.attrs.label.concat(' *') : cc.attrs.label}" />
			<h:inputText id="#{cc.attrs.name}" value="#{cc.attrs.value}" styleClass="form-control" placeholder="#{cc.attrs.placeholder}" required="#{cc.attrs.required}"
				requiredMessage="#{cc.attrs.requiredMessage}" validatorMessage="#{cc.attrs.validatorMessage}" />
			<!-- 			<h:panelGroup layout="block" styleClass="alert alert-danger alert-dismissable" -->
			<!-- 				rendered="#{not empty facesContext.getMessageList(''.concat(cc.clientId).concat(':').concat(cc.attrs.name))}"> -->
			<!-- 				<a href="#" class="close" data-dismiss="alert">&times;</a> -->
			<!-- 				<strong>Fehler!</strong> -->
			<!-- 				<h:message for="#{cc.attrs.name}" tooltip="true" /> -->
			<!-- 			</h:panelGroup> -->

		</h:panelGroup>

	</composite:implementation>

</h:body>
</html>